package edu.study.user.service;

import edu.study.api.common.dto.BaseRespDto;
import edu.study.api.common.enums.BaseResultCodeEnum;
import edu.study.user.api.req.AddRoleReq;
import edu.study.user.dao.RoleDao;
import edu.study.user.dbBean.RoleDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class RoleService {

    @Autowired
    private RoleDao roleDao;

	public BaseRespDto addRole(AddRoleReq req){
    	log.info(">>>RoleService.addRole begin, req={}", req);
        BaseRespDto resp = new BaseRespDto();
        RoleDO roleDO = new RoleDO();
        roleDO = roleDao.insert(roleDO);
        if (roleDO == null) {
            resp.setResultFail(BaseResultCodeEnum.OPERATE_DB_ERROR);
            log.error("<<<RoleService.addRole end, resp={}", resp);
            return resp;
        }
        log.info("<<<RoleService.addRole end, resp={}", resp);
        return resp;
    }
}
